//
//  DBNet.h
//  UsersShop
//
//  Created by gdh on 2018/9/13.
//  Copyright © 2018年 dwj. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AFNetworking/AFNetworking.h>


#pragma mark 网络请求类型
enum HTTPMETHOD{
    METHOD_GET   = 0,
    //GET请求
    METHOD_POST  = 1,
    //POST请求
};


@interface DBNet : NSObject

+ (void)requestCancel;

+ (DBNet *)sharedUtil;/** * iOS自带网络请求框架 */

/** * AF网络请求 */
+(void)Get:(NSString *)URLString
parameters:(NSMutableDictionary*)parameters
   succeed:(void (^)(NSDictionary* data))succeed
   failure:(void (^)(NSError *error))failure;

/** * AF数据请求 */
+(void)PostURL:(NSString *)URLString
    parameters:(NSDictionary*)parameters
       succeed:(void (^)(NSDictionary* data))succeed
       failure:(void (^)(NSError *error))failure;

/** * 上传单张图片 */
+(void)requestAFURL:(NSString *)URLString
         parameters:(id)parameters
          imageData:(NSData *)imageData
            succeed:(void (^)(NSDictionary* data))succeed
            failure:(void (^)(NSError *))failure;
/** * 上传多张图片 */
+(void)requestAFURL:(NSString *)URLString
         parameters:(id)parameters
     imageDataArray:(NSArray *)imageDataArray
            succeed:(void (^)(NSDictionary* data))succeed
            failure:(void (^)(NSError *))failure;
/** * 上传文件 */
+(void)requestAFURL:(NSString *)URLString
         parameters:(id)parameters
           fileData:(NSData *)fileData
            succeed:(void (^)(id))succeed
            failure:(void (^)(NSError *))failure;
/*json * @brief 把格式化的JSON格式的字符串转换成字典 * @param jsonString JSON格式的字符串 * @return 返回字典 */
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
/*json * @brief 把字典转换成字符串 * @param jsonString JSON格式的字符串 * @return 返回字符串 */
+(NSString*)URLEncryOrDecryString:(NSDictionary *)paramDict IsHead:(BOOL)_type;


@end
